package com.tenghu.sbm.utils;

import com.github.pagehelper.PageInfo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;

import java.util.ArrayList;
import java.util.List;

/**
 * 分页实体
 * @author Arvin
 * @date 2017/12/12 15:46
 */
@ApiModel(value = "分页信息",description = "分页信息")
public class PageBean<T> {
    @ApiModelProperty(value = "当前页数",name = "currentPage",dataType = "int")
    private int currentPage=1;
    @ApiModelProperty(value = "每页显示数量",name = "pageSize",dataType = "int")
    private int pageSize=10;
    @ApiModelProperty(value = "总数量",name = "totalNum",dataType = "long")
    private long totalNum;
    @ApiModelProperty(value = "总页数",name = "totalPageSize",dataType = "int")
    private int totalPageSize;

    private List<T> dataResult=new ArrayList<T>();

    public PageBean(PageInfo<T> pageInfo) {
        this.currentPage=pageInfo.getPageNum();
        this.pageSize=pageInfo.getPageSize();
        this.totalNum=pageInfo.getTotal();
        this.totalPageSize=pageInfo.getPages();
        this.dataResult=pageInfo.getList();
    }

    public int getCurrentPage() {
        return currentPage;
    }

    public int getPageSize() {
        return pageSize;
    }

    public long getTotalNum() {
        return totalNum;
    }

    public int getTotalPageSize() {
        return totalPageSize;
    }

    public List<T> getDataResult() {
        return dataResult;
    }
}
